using System.IO;

using lucere.entity;

namespace lucere.index.inversion
{
    public interface IInvertedDocumentConsumerPerField
    {
        /// <summary>
        /// Called once per field, and is given all Fieldable occurrences for this 
        /// field in the document.  Return true if you wish to see inverted tokens 
        /// for these fields:
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="count"></param>
        /// <exception cref="IOException"></exception>
        /// <returns></returns>
        bool Start(IFieldable[] fields, int count);

        /// <summary>
        /// Called before a field instance is being processed
        /// </summary>
        /// <param name="field"></param>
        void Start(IFieldable field);
  
        /// <summary>
        /// Called once per inverted token
        /// </summary>
        /// <exception cref="IOException"></exception>
        void Add();

        /// <summary>
        /// Called once per field per document, after all Fieldable occurrences are inverted
        /// </summary>
        /// <exception cref="IOException"></exception>
        void Finish();

        /// <summary>
        /// Called on hitting an aborting exception
        /// </summary>
        void Abort();
    }
}